<?php
if($nomFonction == 'mime_content_type')
{
  function mime_content_type($file)
  {
    //cette fonction permet de retrouver le mime_type
    $extention = substr(strrchr(basename($file), "."), 1);
    
    $mime_type_ary = array(
    'css'  => 'text/css',
    'html' => 'text/html',
    'htm'  => 'text/html',
    'js'   => 'text/javascript',
    'txt'  => 'text/plain',
    'rtx'  => 'text/richtext',
    'tsv'  => 'text/tab-separated-value',
    'xml'  => 'text/xml',
    'xls'  => 'text/xml',
    
    'eml'  => 'message/rfc822',
    'nws'  => 'message/rfc822',
    
    'bmp'  => 'image/bmp',
    'pcx'  => 'image/bmp',
    'gif'  => 'image/gif',
    'ief'  => 'image/ief',
    'jpeg' => 'image/jpeg',
    'jpg'  => 'image/jpeg',
    'jpe'  => 'image/jpeg',
    'png'  => 'image/png',
    'tiff' => 'image/tiff',
    'tif'  => 'image/tiff',
    'cmu'  => 'image/x-cmu-raster',
    'pnm'  => 'image/x-portable-anymap',
    'pbm'  => 'image/x-portable-bitmap',
    'pgm'  => 'image/x-portable-graymap',
    'ppm'  => 'image/x-portable-pixmap',
    'rgb'  => 'image/x-rgb',
    'xbm'  => 'image/x-xbitmap',
    'xpm'  => 'image/x-xpixmap',
    'xwd'  => 'image/x-xwindowdump',
    
    'dwg'  => 'application/acad',
    'ccad' => 'application/clariscad',
    'drw'  => 'application/drafting',
    'dxf'  => 'application/dxf',
    'xls'  => 'application/excel',
    'hdf'  => 'application/hdf',
    'unv'  => 'application/i-deas',
    'igs'  => 'application/iges',
    'iges' => 'application/iges',
    'doc'  => 'application/msword',
    'dot'  => 'application/msword',
    'wrd'  => 'application/msword',
    'oda'  => 'application/oda',
    'pdf'  => 'application/pdf',
    'ppt'  => 'application/powerpoint',
    'ai'   => 'application/postscript',
    'eps'  => 'application/postscript',
    'ps'   => 'application/postscript',
    'rtf'  => 'application/rtf',
    'rm'   => 'application/vnd.rn-realmedia',
    'dvi'  => 'application/x-dvi',
    'gtar' => 'application/x-gtar',
    'tgz'  => 'application/x-gtar',
    'swf'  => 'application/x-shockwave-flash',
    'tar'  => 'application/x-tar',
    'gz'   => 'application/x-gzip-compressed',
    'zip'  => 'application/zip',
    'xhtml'=> 'application/xhtml+xml',
    'xht'  => 'application/xhtml+xml',
    
    'au'   => 'audio/basic',
    'snd'  => 'audio/basic',
    'aif'  => 'audio/x-aiff',
    'aiff' => 'audio/x-aiff',
    'aifc' => 'audio/x-aiff',
    'wma'  => 'audio/x-ms-wma',
    
    'mpeg' => 'video/mpeg',
    'mpg'  => 'video/mpeg',
    'mpe'  => 'video/mpeg',
    'mov'  => 'video/quicktime',
    'avi'  => 'video/msvideo',
    'movie'=> 'video/x-sgi-movie',
    
    'unknow' => 'application/octet-stream'
    );
      
    return (!empty($mime_type_ary[$extention])) ? $mime_type_ary[$extention] : $mime_type_ary['unknow'];
  } 
}

?>
